<?php
function smarty_function_captcha($params, &$smarty)
{
	$strSession = isset($params['session']) ? $params['session'] : '';	
	$i = 0;
	do {
		$i++;
		$strImg	= Ecore_Captcha_Image::getCaptchaId($strSession) . '.jpg';		
		if (file_exists(ROOT_DIR . '/data/upload/captcha/' . $strImg)) break;
	} while ($i <= 100);
	return '<img src="' . HOST_IMG . 'captcha/' . $strImg . '" alt="'. DOMAIN.'" width="140" height="36" />';
}
?>